package svc

import (
	"im_sys/apps/im/immodels"
	"im_sys/apps/im/rpc/internal/config"
)

type ServiceContext struct {
	Config config.Config

	immodels.ChatLogModel
	immodels.ConversationModel
	immodels.UserConversationModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,

		ChatLogModel:          immodels.NewChatLogModel(c.MongoDB.Url, c.MongoDB.DB, "chat_log"),
		ConversationModel:     immodels.NewConversationModel(c.MongoDB.Url, c.MongoDB.DB, "conversation"),
		UserConversationModel: immodels.NewUserConversationModel(c.MongoDB.Url, c.MongoDB.DB, "user_conversation"),
	}
}
